class Album {
  final String id;
  final String creator;
  final int createDate;
  final String name;
  final String uid;
  final String cover;
  final int? sort;
  final int imgCount;
  final int collectionCount;
  final String? updater;
  final int updateDate;

  Album({
    required this.id,
    required this.creator,
    required this.createDate,
    required this.name,
    required this.uid,
    required this.cover,
    this.sort,
    required this.imgCount,
    required this.collectionCount,
    this.updater,
    required this.updateDate,
  });
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'creator': creator,
      'createDate': createDate,
      'name': name,
      'uid': uid,
      'cover': cover,
      'sort': sort,
      'imgCount': imgCount,
      'collectionCount': collectionCount,
      'updater': updater,
      'updateDate': updateDate,
    };
  }
  factory Album.fromJson(Map<String, dynamic> json) {
    return Album(
      id: json['id'],
      creator: json['creator'],
      createDate: json['createDate'],
      name: json['name'],
      uid: json['uid'],
      cover: json['cover'],
      sort: json['sort']?.toInt(),
      imgCount: json['imgCount'].toInt(),
      collectionCount: json['collectionCount'].toInt(),
      updater: json['updater'],
      updateDate: json['updateDate'].toInt(),
    );
  }
}
